<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateResourcesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('resources', function (Blueprint $table) {
            $table->increments('id');
            $table->string('file_name')->comment('加密后的文件名');
            $table->integer('cost')->default(0)->comment('资源价值分');
            $table->integer('cost_type')->default(0)->comment('资源价值类型，1：积分，2：D币');
            $table->integer('topic_id')->unsigned()->default(0)->index()->comment('话题ID');
            $table->tinyInteger('type')->default(0)->comment('资源类型，1:文献，2：书籍，3:代码，3:其他');
            $table->tinyInteger('category')->default(0)->comment('资源分类[与topics分类不是一回事]，1:基础理论，2:语音信号处理，3:图像处理，4：matlab应用，5：python应用，6：算法库应用，7：其他');
            $table->Integer('download_count')->default(0)->comment('被下载的次数');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('resources');
    }
}
